from flask import jsonify


class APIResponse:
    def __init__(self, code, message, data=None):
        self.code = code
        self.message = message
        self.data = data

    def to_json(self):
        return jsonify({
            'code': self.code,
            'message': self.message,
            'data': self.data
        })
